<!DOCTYPE html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>有贝口腔网-登录</title>
    <meta name="keywords" content="有贝口腔网,口腔网,口腔知识,口腔资讯,口腔问答,口腔诊所,口腔厂家,在线看牙">
    <meta name="description" content="有贝口腔网是一家专注互联网口腔服务网站，为用户提供腔知识,口腔资讯,口腔问答,口腔诊所,诊所入住,口腔厂家,厂家入住,在线看牙等综合服务口腔网站">
   <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/login.css">
    <script src="../js/jquery-3.5.1.min.js"></script>
    <link rel="stylesheet" href="../css/layer.css" id="layuicss-layer">
    <script type="text/javascript">
        var basePath ="/";
    </script>
    <script src="../js/common.js"></script>

    <script src="../js/footfixed.js"></script>

    <script src="../js/md5.js"></script>
    <script src="../js/layer.js"></script>

    <script type="text/javascript">

      $(function() {

          function login() {
              var userName = $("#phone").val();
              var code = $("#check-code").val();//短信验证码
              var pwd = $("#password").val();
              var rcode = $("#code").val();//图形验证码

              if (isBlank(userName)) {
                  //alert("请输入用户名");
                  layer.msg("请输入用户名");
                  return;
              }
              //如果密码不为空
              if (isBlank(pwd)) {
                  // alert("请输入图形验证码");
                  layer.msg("请输入密码");
                  return;
              }
              if (pwd.length < 6) {
                  //alert("请正确输入密码");
                  layer.msg("请正确输入密码");
                  return;
              }
              if (isBlank(rcode)) {
                  // alert("请输入图形验证码");
                  layer.msg("请输入图形验证码");
                  return;
              }

              pwd = MD5(pwd);

              var data = {};
              data["userName"] = userName;
              data["code"] = rcode;
              data["password"] = pwd;
              $.ajax({
                  type: "POST",
                  url: basePath + "login?t=" + new Date().getTime(),
                  data: data,
                  success: function (datas) {
                      window.console.log(datas)
                      if (datas.code == 200) {
                          document.cookie="mycookie="+datas.token;
                          window.location.href = "/sys/index";
                      } else {
                          layer.msg(datas.msg);
                      }

                  },
                  error: function (XMLHttpRequest, textStatus, errorThrown) {
                      alert("链接错误,请联系管理员");
                  }
              })
          }


          $("#codeImg").click(function () {
              reCode();
          });

          function reCode() {
              $("#codeImg").attr("src", "/user/kaptcha?r=" + new Date());
          }

          $(".login-btn").click(function () {
              //登录
              login();
          })

      })
    </script>
</head>
<body>
<div class="container">

    <input id="isd" value="" type="hidden">
    <!-- 是否弹窗隐藏 -->
    <div>
        <h1>Welcome</h1>
        <h2>欢迎登录有贝口腔网</h2>
    </div>
    <form class="form" onsubmit="return false;">
        <div class="form-top">
            <a class="active" href="javascript:;">系统用户登录</a>
        </div>

        <div class="form-mian">

            <div class="login">
                <label>
                    <input type="text" placeholder="请输入用户名" id="phone" name="phone">
                </label>
                <label class="login-phone">
                    <input type="password" minlength="6" placeholder="请输入6~18位密码" id="password" name="name">
                </label>

                <div class="img-check-code">
                    <label>
                        <input placeholder="请输入图形验证码" id="code" name="code">
                    </label>
                    <img id="codeImg" alt="有贝口腔网" src="/user/kaptcha">
                </div>

                <div class="num-check-code" style="display: none;">
                    <label>
                        <input type="text" placeholder="请输入验证码" id="check-code" name="check-code">
                    </label>
                    <button class="send-btn" type="button">发送验证码</button>
                </div>

                <input class="sub-btn login-btn" type="submit" value="登录">
                <div class="form-bottom">
                    <!--<div class="login-type-change" res="0">手机/邮箱验证码登录</div>-->
                    <!-- <div class="forget-password"><a href="http://www.hasbei.com/findpwd" target="_blank">忘记密码</a></div>-->
                </div>
            </div>
        </div>

    </form>
</div>

</body></html>